<template>
	<div class="mainContent">
		<div class="bread-nav">
			<span class="bread-item">仓储管理</span>
			<span class="bread-icon">&gt;</span>
			<span class="bread-item">盘点管理</span>
			<span class="bread-icon">&gt;</span>
			<span class="bread-item">抽盘列表</span>
		</div>
		<!-- <pathTracking :path="Model.path" /> -->
		<div class="addcont">
			<div class="add" @click="newDip">
				<img class="plus" src="@/assets/img/button_plus.png" alt="">
				<p class="font">新建抽盘任务</p>
			</div>
		</div>
		<div class="container">
			<div class="searchbox">
				<card :configArr="Model.configArr"></card>
				<el-row>
					<div class="common-table-title">
						<div class="common-table-icon"></div>
						<div class="common-table-fl">查询条件</div>
					</div>
				</el-row>
				<!-- 搜索框 -->
				<advancedSearch :option="Model.filterOption" @getChild="showChild" @onSearch="toSearch" @onClear="toClear"
				 @onExport="toExport"></advancedSearch>
			</div>
			<div class="table">
				<el-row>
					<div class="common-table-title">
						<div class="common-table-icon"></div>
						<div class="common-table-fl">盘点列表</div>
						<div class="common-btn-group">
							<div class="common-table-btn-item" @click="trackingNo(1)">导出应盘数据</div>
							<div class="common-table-btn-item" @click="trackingNo(2)">导出盘点结果</div>
						</div>
					</div>
				</el-row>
				<div style="padding-left: 16px;background-color: #fff;">
					<el-table stripe :data="Model.tableData" border :row-style="selectedHighlight" @selection-change="handleSelectionChange">
						<el-table-column type="selection" width="50" fixed></el-table-column>
						<el-table-column align="center" prop="countingNumber" label="盘点单号" width="160">
							<template slot-scope="scope">
								<el-button type="text" @click="toDetial(scope.row,'detail')"><a class="detial-link">{{scope.row.countingNumber}}</a></el-button>
							</template>
						</el-table-column>
						<el-table-column align="center" v-for="(item,index) in Model.tableHeaderData" :key="item.prop" :prop="item.prop"
						 :width="item.width" :label="item.label">
						</el-table-column>
						<el-table-column label="操作" fixed="right" align="center" width="150">
							<template slot-scope="scope">
								<div class="btnGroup">
									<div v-if="scope.row.inventoryStatus == 1" class="operate-btn" @click="toDetial(scope.row,'dip')">开始盘点</div>
									<div v-if="scope.row.inventoryStatus == 2" class="operate-btn" @click="toDetial(scope.row,'dip')">继续盘点</div>
									<div v-if="scope.row.inventoryStatus == 2" class="operate-btn" @click="changeRowStatus(scope.row,3)">结束盘点</div>

									<div v-if="scope.row.inventoryStatus == 3" class="operate-btn" @click="submitDip(scope.row)">提交盘点报告</div>
									<div v-if="scope.row.inventoryStatus == 3" class="operate-btn" @click="changeRowStatus(scope.row,2)">反审核</div>
								</div>
							</template>
						</el-table-column>
					</el-table>
				</div>

				<!--  -->
				<el-row class="pagination-cont">
					<el-pagination @size-change="handleSizeChange" background @current-change="handleCurrentChange" :current-page="Model.paginationObject.currentPage"
					 :page-sizes="[10, 20, 30, 40]" :pager-count="5" :page-size="Model.paginationObject.pageSize" layout="sizes, prev, pager, next, jumper, slot"
					 :total="Model.paginationObject.total">
						<div class="pagination-slot">
							显示
							<p class="slot-i">{{Model.paginationObject.num1}}</p>
							到
							<p class="slot-i">{{Model.paginationObject.num2}}</p>
							，共
							<p class="slot-i">{{Model.paginationObject.total}}</p>
							记录
						</div>
					</el-pagination>
				</el-row>
			</div>

		</div>
		<!-- 新建弹框 -->
		<el-dialog :visible.sync="Model.importFileDialog" class="minDialog">
			<div class="common-table-title">
				<div class="common-table-icon"></div>
				<div class="common-table-fl">上传盘点数据</div>
			</div>
			<div style="background: #fff;">
				<el-row class="common-table-con">
					<div class="fileup-cont">
						<input class="fileup" type="file" name="fileup" id="fileup" v-on:change="fileChange($event)" />
						<div class="fileup-name">{{Model.fileupName}}</div>
						<div class="fileup-btn">浏览</div>
					</div>
				</el-row>
				<el-row class="dialog-btn-group">
					<div class="dialog-btn dialog-btn-confirm" @click="uploadExcel">确定上传</div>
				</el-row>
				<el-row>
					<p class="template-name" @click="downloadExcel()">下载盘点数据导入模板</p>
				</el-row>
			</div>
		</el-dialog>

	</div>
</template>

<script>
	import pathTracking from "@/components/common/pathTracking";
	import card from '@/components/common/filterBtns';
	import advancedSearch from "@/components/common/filter/advancedSearch";
	import {
		getDateString
	} from "@/assets/js/common.js";
	import Model from "./model.js";
	import Controller from "./controller.js";
	export default {
		name: "purchase",
		mixins: [Model, Controller],
		components: {
			advancedSearch,
			card,
			pathTracking
		}
	};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
	@import "./index.less";
</style>
